package jsjDemo;

import java.util.Objects;

public class Person {
    private String name;
    int age;
    String hobby;
    public Person(){

    }
    public  Person(String name,int age,String hobby){
        this.name=name;
        this.age=age;
        this.hobby=hobby;
    }
    public void setName(String name){
        this.name=name;
    }
    public String getName(){
        return name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    public int getAge() {
        return age;
    }

    public String getHobby() {
        return hobby;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return age == person.age &&
                Objects.equals(name, person.name) &&
                Objects.equals(hobby, person.hobby);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, hobby);
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", hobby='" + hobby + '\'' +
                '}';
    }
}
